package com.jastar.android.game.cannon.utils;

public class GameUtils {

    public static float calculateDistance(float x1, float y1, float x2, float y2) {
        return (float) Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
    }

    public static float clamp(float value, float min, float max) {
        return Math.max(min, Math.min(max, value));
    }

    public static int randomInt(int min, int max) {
        return (int) (Math.random() * (max - min + 1)) + min;
    }

    public static float randomFloat(float min, float max) {
        return (float) (Math.random() * (max - min)) + min;
    }

}